package test.arch.chameleon.support.util;

import org.junit.Test;

import test.module.AbstractTimerTestSupport;
import arch.chameleon.support.util.EncodeUtils;
import arch.chameleon.support.util.SecurityUtils;
import arch.chameleon.support.util.SecurityUtils.DigestAlgorithm;

/**
 * 安全工具类测试
 * @author George
 *
 */
public class SecurityUtilsTestcase extends AbstractTimerTestSupport{

	/**
	 * MD5摘要测试
	 */
	@Test
	public void md5Digest(){
		watch.start();
		
		byte[] aryPrimMd5Digest = SecurityUtils.DigestFunc.digest(new String("admin123").getBytes(), DigestAlgorithm.MD5, null, 1024);
		
		String strHexCode = EncodeUtils.encodeHex(aryPrimMd5Digest);
		
		watch.stop();
		
		log.debug("digest hex string with 1024 times iteration cost: {}ms", new Object[]{watch.getTime()});
		
		log.debug("digest hex string with 1024 times : {}", new Object[]{strHexCode});
	}
}
